define(function (require, exports, module) {

  require("mixins/global.mixins.js");
  var mCard = require('andrew/card/index.js')
  var toastr = require("third/toastr/index.js");

  var api = require('service/api.js');
  let id = 1000;
  var pageVue = new Vue({
    data: {
      CategoryTreeList: [],
      filterText: '',
      formCollapse: false
    },
    watch: {
      filterText(val) {
        this.$refs.tree2.filter(val);
      }
    },
    mounted: function () {
      this.queryCategoryTreeList();
    },
    methods: {
      filterNode(value, data) {
        if (!value) return true;
        return data.label.indexOf(value) !== -1;
      },
      queryCategoryTreeList: function () {
        var curPageVue = this;
        var data = {};
        $.ajax({
          type: 'POST',
          url: QUERY_CONFIG_LIST_URL,
          contentType: 'application/json',
          data: JSON.stringify(data),
          dataType: "json",
          success: function (result) {
            console.log(result);
            curPageVue.CategoryTreeList = result;
          }
        });
      },
      append: function (row) {
        pageVue = this
        layer.open({
          type: 2,
          title: '新增配置信息',
          shade: [0],
          area: ['50%', '50%'],
          content: ['edit.html'],
          end: function(){
            pageVue.queryCategoryTreeList();
          }
        });
      },

      remove: function (node, data) {
        pageVue = this;
        layer.confirm('确定删除？', {
          btn: ['确认', '取消'] //按钮
        }, function (index) {
          layer.close(index);
          toastr.success("新增成功!");
          const parent = node.parent;
          const children = parent.data.children || parent.data;
          const i = children.findIndex(d => d.id === data.id);
          children.splice(i, 1);
        });




      },


    }

  }).$mount('#app')
})
